#ifndef _RC_DRIVER_H
#define _RC_DRIVER_H
#include "stdio.h"
#include "usart.h"
#include "cmsis_os.h"
#include "stdbool.h"
extern osSemaphoreId_t RcSemBinaryHandle;
#define RC_DATA_LENGTH 18
#define RC_SW_UP 1//拨杆上
#define RC_SW_MID 3//拨杆中
#define RC_SW_DOWN 2//拨杆下

#define RC_CH_VALUE_MIN 364.f
#define RC_CH_VALUE_MID 1024.f
#define RC_CH_VALUE_MAX 1684.f

typedef struct
{
    struct
    {
        int rc_dog;
        int rc_is_valid;
    }Rc_Dog;
    struct
    {
        uint16_t ch0;
        uint16_t ch1;
        uint16_t ch2;
        uint16_t ch3;
        uint8_t s1;
        uint8_t s2;
    }rc;
    struct
    {
        float channel0;
        float channel1;
        float channel2;
        float channel3;
    }back_one;
}RC_Ctl_t;
extern RC_Ctl_t RC_Ctl;
extern RC_Ctl_t RC_Ctl_last;
void Rc_Start();
void RCData_Process(RC_Ctl_t * RC_Ctl,unsigned char sbus_rx_buffer[]);
void RCData_back_one();
void RC_dog_init();
bool Rc_CRC();
#endif //_RC_DRIVER_H